{% if total_page > 1 %}
<nav class="page-nav">
  <ul class="pagination">
    <li style="position: relative;float: left;margin-right: 20px;">
      <select id="page-limit" style="height:34px">
          {% for id in [10,20,30,40,50,100] %}
              {% if limit == id %}
              <option value="{{ id }}" selected>{{ id }}</option>
              {% else %}
              <option value="{{ id }}">{{ id }}</option>
              {% end %}
          {% end %}
      </select>
    </li>
    <li {% if page ==1 %} class="disabled"{% end %}>
      <a {% if page != 1 %} href="{{ nav_url }}/{{ page-1 }}/{{ limit }}" {% end %} aria-label="上一页">
        <span aria-hidden="true">&laquo;</span>
      </a>
    </li>
    {% for i in range(total_page) %}
      {% if total_page > 13 and i >= 5 and i < total_page - 5 %}
        {% if i < 6 or i >= total_page - 6 %}
            {% if page == i+1 %}
                {% if i > total_page / 2 - 1 %}
                <li><a>...</a></li>
                {% end %}
                <li {% if page == i+1 %} class="active" {% end %} ><a data-nav="{{ nav_url }}/{{ i+1 }}" href="{{ nav_url }}/{{ i+1 }}/{{ limit }}">{{ i+1 }}</a></li>
                {% if i < total_page / 2 %}
                <li><a>...</a></li>
                {% end %}
            {% else %}
                <li><a>...</a></li>
            {% end %}
        {% elif page == i+1 %}
            {% if total_page % 2 != 0 %}
                {% if i > total_page / 2 %}
                    <li><a>...</a></li>
                {% end %}
            {% else %}
                {% if i > total_page / 2 - 1 %}
                    <li><a>...</a></li>
                {% end %}
            {% end %}
            <li {% if page == i+1 %} class="active" {% end %} ><a data-nav="{{ nav_url }}/{{ i+1 }}" href="{{ nav_url }}/{{ i+1 }}/{{ limit }}">{{ i+1 }}</a></li>
            {% if total_page % 2 != 0 %}
                {% if i < total_page / 2 - 1 %}
                    <li><a>...</a></li>
                {% end %}
            {% else %}
                {% if i < total_page / 2 %}
                    <li><a>...</a></li>
                {% end %}
            {% end %}
        {% end %}
      {% else %}
        <li {% if page == i+1 %} class="active" {% end %} ><a data-nav="{{ nav_url }}/{{ i+1 }}" href="{{ nav_url }}/{{ i+1 }}/{{ limit }}">{{ i+1 }}</a></li>
      {% end %}
    {% end %}
    <li {% if page == total_page %} class="disabled"{% end %}>
      <a {% if page != total_page %} href="{{ nav_url }}/{{ page+1 }}/{{ limit }}" {% end %} aria-label="下一页">
        <span aria-hidden="true">&raquo;</span>
      </a>
    </li>
    <li style="position: relative;float: left;margin-left: 20px;">
        <input type="text" id="go-to" style="width:49px;height:34px" placeholder="GO TO" data-nav="{{ nav_url }}">
    </li>
  </ul>
</nav>
{% end %}